package com.sjmsks.Jpanels.work.shape;

import java.awt.*;

// 自定义的矩形控件
public class Rectangle extends AbstractShape {


	@Override
	public void draw(Graphics2D g2d) {
		g2d.setColor(getColor());
		g2d.setStroke(getStroke());
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.drawRect(Math.min(x1, x2), Math.min(y1, y2), Math.abs(x1 - x2),
				Math.abs(y1 - y2));
	}

	@Override
	public Color getColor() {
		return super.getColor();
	}

	@Override
	public void setColor(Color color) {
		super.setColor(color);
	}

	@Override
	public Stroke getStroke() {
		return super.getStroke();
	}

	@Override
	public void setStroke(Stroke stroke) {
		super.setStroke(stroke);
	}
}
